package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.ebean.Model;

@Entity
@Table(name = "perfis")
public class Perfis extends Model{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	@Column(name = "perf_id")
	private Integer id;
	
	@Column(name = "perf_nome", nullable = false, length = 150)
	private String nome;
	
	@OneToMany(mappedBy = "perfil", fetch = FetchType.LAZY)
	private List<Usuarios> usuarios;
	
	@OneToMany(mappedBy = "perfis", fetch = FetchType.LAZY)
	private List<ItensPerfis> itensPerfis;

	public Perfis() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}
	
	public List<Usuarios> getUsuarios() {
		return usuarios;
	}

	public void setUsuarios(List<Usuarios> usuarios) {
		this.usuarios = usuarios;
	}

	public static Model.Finder<Integer, Perfis> find =  new Finder<Integer, Perfis>(Integer.class, Perfis.class);

}
